package mms

class Company {

    String name // 企业名称
    String loginName
    String password
    String address //地址
    Person incorporator //企业法人
    Person manager // 企业负责人
    String contact // 电话
    String level = '无'// 诚信等级
    String sellOfYear //年销售额
    static hasMany = [employees:Person , history:String , improper:String, multimedia: Multimedia ]
    String gis = ""//  gis 的id
    String latitude  = "" // 纬度
    String longitude = ""// 经度
    String live = ""
    List multimedia

    List history // 企业变更纪录
    List improper // 不良记录
    List employees // 企业员工
    static xmlTransients = ['history','improper','employees','multimedia'] 
//    static hasMany = []
//    static belongsTo = []
//    static transients = [] 

//    table 'xedu_article'
//    sort  lastTime
    static mapping = {
    }
    //blank 
    //email
    //inList
    //matches 
    //nullable 
    //size
    //unique
    //url 
    static constraints = {
        name(blank:false)
        loginName(blank:false,size:3..20)
        password(blank:false,size:3..10)
        address(blank:false)
        live(blank:true)
        incorporator(nullable:true)
        manager(nullable:true)
        contact(blank:false,matches:"[0-9|-]+")
        level(blank:true,inList:['无','良好','正常','差'])
        sellOfYear(blank:true)
        gis(blank:true)//  gis 的id
        latitude(blank:true,matches:"[0-9|\\.]+")   // 纬度
        longitude(blank:true,matches:"[0-9|\\.]+") // 经度
    }

    String toString() {
        "${name}"
    } 
}
